import { ref, computed, reactive } from 'vue'
import { defineStore } from 'pinia'
import {SchoolList} from '@/http/index.js'

export const useCounterStore = defineStore('school', () => {
  const tableData = ref([])
  const tablePage = reactive({
    current_page: 1, //当前页
    per_page: 10, //每页条数
    total: 0, //总条数
    page_size: [10, 20, 30], //可选分页条数
  });
  const  schoolList = async (e)=> {
    const data = await SchoolList(e)
    console.log(data);
    if (data.code == 200) {
         data.data.data.map(e=>e.status == 1 ?  e.statuss = '正常' :    e.statuss = '禁用')
          tableData.value = data.data.data
          tablePage.current_page = data.data.current_page
          tablePage.per_page = data.data.per_page
          tablePage.total = data.data.total
    }
  }
  return {tableData, schoolList,tablePage }
})
export const userouteStore = defineStore('route', () => {
  const showInfo = ref(false)
  const data = ref({})
  return {showInfo, data}
})
export const useAdminStore = defineStore('admin', () =>{
     const adminList = ref([])
     return {adminList}
})


